
import React, { useState } from 'react';
import { Row, Col, Card, Switch, Statistic, Tooltip, Space } from 'antd'
import { history, connect } from 'umi';
import { ExclamationCircleOutlined, } from '@ant-design/icons'
import PromoterManage from './components/PromoterManage';
import PromoterShop from './components/PromoterShop'
import PromoterMaterial from './components/PromoterMaterial';
import Setting from './components/Setting';
import Customer from './components/Customer';
import Reward from './components/Reward'
import CashWithdrawal from './components/CashWithdrawal';
import PromoterPerformance from './components/PromoterPerformance/components/PromoterPerformanceList';
import PromoterCommission from './components/PromoterCommission/components/PromoterPerformanceList';
import PromoterGroup from './components/PromoterGroup';
import ShareRecord from './components/ShareRecord';
const Promoter = (props) => {
    const [activeTabKey, setActiveTabKey] = useState('promoterManage');
    const [childActiveTabKey, setChildActiveTabKey] = useState('ruleSetting');
    const tabList = [
        {
            key: 'promoterManage',
            tab: '推广员列表',
        },
        {
            key: 'promoterShop',
            tab: '推广商品',
        },
        {
            key: 'promoterMaterial',
            tab: '推广素材',
        },
        {
            key: 'customer',
            tab: '客户管理',
        },
        {
            key: 'reward',
            tab: '奖励配置',
        },
        {
            key: 'promoterPerformance',
            tab: '推广员业绩',
        },
        {
            key: 'promoterCommission',
            tab: '推广员佣金',
        },
        {
            key: 'cashWithdrawal',
            tab: '提现记录',
        },
        {
            key: 'setting',
            tab: '设置',
        },
        {
            key: 'promoterGroup',
            tab: '分组管理',
        },
        {
            key: 'shareRecord',
            tab: '推广记录',
        },
    ];
    const zm = () => {
        setActiveTabKey('setting')
        setChildActiveTabKey('promoterSetting')
    }
    const contentList = {
        setting: <Setting activeTabKey={childActiveTabKey} setActiveTabKey={setChildActiveTabKey}></Setting>,
        promoterShop: <PromoterShop></PromoterShop>,
        promoterManage: <PromoterManage zm={zm}></PromoterManage>,
        promoterMaterial: <PromoterMaterial></PromoterMaterial>,
        customer: <Customer></Customer>,
        promoterCommission: <PromoterCommission></PromoterCommission>,
        cashWithdrawal: <CashWithdrawal></CashWithdrawal>,
        reward: <Reward></Reward>,
        promoterPerformance: <PromoterPerformance></PromoterPerformance>,
        promoterGroup: <PromoterGroup></PromoterGroup>,
        shareRecord: <ShareRecord></ShareRecord>
    };
    const onTabChange = (key) => {
        setActiveTabKey(key);
    };
    return <Card
        style={{
            width: '100%',
        }}
        tabList={tabList}
        activeTabKey={activeTabKey}
        onTabChange={onTabChange}
    >
        {contentList[activeTabKey]}
    </Card>

}

export default connect(({ loading }) => ({
    loading: loading.models.institution,
}))(Promoter);
